import { ComputedRef, Ref } from "vue";

export interface UseAppendedButton {

    appendedButtonClass: ComputedRef<Record<string, boolean>>;

    appendedContent: Ref<string>;

    appendedContentTemplate: Ref<HTMLElement | null>;

    shouldShowAppendedButton: ComputedRef<boolean>;

}

export interface UseClear {

    clearButtonClass: ComputedRef<Record<string, boolean>>;

    clearButtonStyle: ComputedRef<Record<string, any>>;

    hasShownClearButton: Ref<boolean>;

    onClearValue: ($event: MouseEvent) => void;

    onMouseEnter: ($event: MouseEvent) => void;

    onMouseLeave: ($event: MouseEvent) => void;

    shouldShowClearButton: ComputedRef<boolean>;
}

export interface UsePassword {

    isPassword: Ref<boolean>;

    onClickAppendedButton: () => void;

}

export interface UseTextBox {

    changeTextBoxValue: (newValue: any, shouldEmitChangeEvent?: boolean) => void;

    disabled: Ref<boolean>;

    editable: Ref<boolean>;

    inputGroupEditorClass: ComputedRef<Record<string, boolean>>;

    inputType: Ref<string>;

    isEmpty: ComputedRef<boolean>;

    modelValue: Ref<string>;

    onBlur: (event: FocusEvent) => void;

    onEnter: ($event: KeyboardEvent) => void;

    onInputClick: ($event: MouseEvent) => void;

    onInputFocus: ($event: FocusEvent) => void;

    onMousedown: ($event: MouseEvent) => void;

    onTextBoxValueChange: ($event: Event) => void;

    readonly: ComputedRef<boolean>;

    textBoxPlaceholder: ComputedRef<string>;
}
/**
 * 一条资料信息
 */
export interface ResourceInfo {
    id: string;
    course?: string;//科目
    title: string;//标题
    content: string;//内容
    overview: string;
    creator?:string;//作者
}
/**
 * 资料科目
 */
export interface ResourceCourse {
    id: string;
    category: string;// 所属类别
    title: string;//科目名称
    cover: string;//封面
    overview: string;//简述
    resourceList: Array<ResourceInfo>;// 下属资料列表
    creator?:string;//作者
}
/**
 * 资料分类
 */
export interface ResourceCategory {
    id: string;
    title: string;//科目名称
    cover: string;//封面
    overview: string;//简述
    courseList: Array<ResourceCourse>;// 下属科目列表
}
/** 页头的标签页 */
export enum HeaderNavType {
    'HomePage' = 'HomePage',
    'PersonalCenter' = 'PersonalCenter',
    'CreateResouce' = 'CreateResouce',
    Category = 'Category'
}

export interface UserInfo {
    id: string;
    name: string;
    avatar: string;
    categories: Array<ResourceCategory>;

}
export const PlayModes = [
    { type: 'one', text: '单曲循环' },
    { type: 'loop', text: '循环' },
    { type: 'shuffle', text: '随机' }
];
export const ProficiencyLevel = [
    { value: 'skilled', name: '熟练' },
    { value: 'unfamiliar', name: '不熟' },
    { value: 'notMemorized', name: '未背' },
]
/**
 * 语音播放状态
 */
export enum PlayState {
    titleStart = "titleStart",
    contentStart = "contentStart",
    error = "error",
    stop = "stop",
    titleEnd = "titleEnd",
    contentEnd = "contentEnd",
}
/**
 * 播放进度
 */
export interface SpeechProgress{
    highlightText:string,
    realProgress:string,
    totalLength:number,
    speechLength:number,
    curType:string
}

export interface UseTextToSpeech{
    progress:Ref<SpeechProgress>;
    speechState:Ref<string>;
}
export interface UtteranceSettings {
    lang: string,
    voice: string,
    pitch: number,
    rate: number,
    volume: number
}

export interface ShareType{
    curResource:ResourceInfo|null
    curResourceCourse:ResourceCourse|null
}

export enum PersonalCenterTab {
    homePage = 'homePage',
    courseManagement = 'courseManagement',
    categoryManagement = 'categoryManagement',
    createResource = 'createResource',
    setting = 'setting'

}